package com.quanyan.place.entity.vo;

import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Created by yangyun on 16-5-28.
 */
public class PlaceUnitSalePlan implements Serializable {

    private Integer id;

    private Integer placeId;

    private Integer categoryId;

    private String placeUnitName;

    private Integer placeUnitId;

    private Byte status;  // 状态

    private String timeType; // 星期

    private String startTime;

    private String endTime;

    private BigDecimal price;

    private BigDecimal memberPrice;

    private BigDecimal lowestPrice;

    private Integer uid; // 当前登录用户uid

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPlaceId() {
        return placeId;
    }

    public void setPlaceId(Integer placeId) {
        this.placeId = placeId;
    }

    public Integer getPlaceUnitId() {
        return placeUnitId;
    }

    public void setPlaceUnitId(Integer placeUnitId) {
        this.placeUnitId = placeUnitId;
    }

    public Integer getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }

    public String getTimeType() {
        return timeType;
    }

    public void setTimeType(String timeType) {
        this.timeType = timeType;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getMemberPrice() {
        return memberPrice;
    }

    public void setMemberPrice(BigDecimal memberPrice) {
        this.memberPrice = memberPrice;
    }

    public BigDecimal getLowestPrice() {
        return lowestPrice;
    }

    public void setLowestPrice(BigDecimal lowestPrice) {
        this.lowestPrice = lowestPrice;
    }

    public Byte getStatus() {
        return status;
    }

    public String getPlaceUnitName() {
        return placeUnitName;
    }

    public void setPlaceUnitName(String placeUnitName) {
        this.placeUnitName = placeUnitName;
    }

    public void setStatus(Byte status) {
        this.status = status;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public boolean equals(Object obj){
        if(obj == null){
            return false;
        }else {
            if(this.getClass() == obj.getClass()){
                PlaceUnitSalePlan other = (PlaceUnitSalePlan) obj;
                if (null == this.id || null == other.id){
                    if (null != this.placeUnitId &&
                        null != other.placeUnitId &&
                            StringUtils.isNotEmpty(this.startTime) &&
                            StringUtils.isNotEmpty(other.startTime) &&
                            StringUtils.isNotEmpty(this.endTime) &&
                            StringUtils.isNotEmpty(other.endTime) &&
                            StringUtils.isNotEmpty(this.timeType) &&
                            StringUtils.isNotEmpty(other.timeType) &&
                            this.placeUnitId.equals(other.placeUnitId) &&
                            this.startTime.equals(other.startTime) &&
                            this.endTime.equals(other.endTime) &&
                            this.timeType.equals(other.timeType))
                    {
                        return true;
                    }
                } else {
                    if(this.getId().equals(other.getId())) {
                        return true;
                    }
                }
                return false;
            }else{
                return false;
            }
        }
    }

    public int hashCode(){
        int result = 17;
        if (placeId != null){
            result = 37 * result + placeId;
        }
        if (placeUnitId != null){
            result = 37 * result + placeUnitId;
        }
        if (timeType != null){
            result = 37 * result + timeType.hashCode();
        }
        if (startTime != null){
            result = 37 * result + startTime.hashCode();
        }
        if (endTime != null){
            result = 37 * result + endTime.hashCode();
        }
        return result;
    }
}
